1. Field of the Invention
The present invention relates to an image processing apparatus, image processing method, and computer-readable medium which correct a color balance of input digital image data.
2. Description of the Related Art
Conventionally, a method of estimating a light source at the time of shooting of image data shot by a digital camera or that obtained by optically scanning a film shot by an analog camera, and applying a color balance correction to the image data has been proposed.
Japanese Patent Laid-Open No. 2002-152772 describes the following method. That is, a blackbody locus of gray and human skin color pixels based on a representative spectral distribution of a camera is held in advance. RGB components of respective pixels are multiplied by various coefficients so as to attain inverse conversions of a color balance correction of a camera, and the number of pixels after conversion, which are located adjacent to the blackbody locus, is evaluated, thereby estimating a light source at the time of shooting. After the light source is estimated, the converted image is converted into colors under a predetermined light source.
The aforementioned color balance correction method suffers the following problem. That is, the light source estimation result based on the technique described in the above conventional reference is not always correct. An example of this problem will be described below using the following two color balance correction examples.
The first color balance correction is a method described in Japanese Patent Laid-Open No. 2002-152772. A light source at the time of shooting of a target image is estimated based on a distribution of gray and skin color pixels, and a color balance correction is executed using a color temperature (unit: K (Kelvin)) of the light source based on the above estimation.
On the other hand, a conventional method of executing a color balance correction based on a color of a bright region (highlight color: HL color) of an image has been proposed. In this method, the bright region of an image basically corresponds to, for example, a white wall in a room or a white shirt, that is, an originally white object, and its color is likely to reflect the color of a light source at the time of shooting to some extent. For this reason, if the color of the bright region is an achromatic color, it can be judged that a color balance of an image is relatively proper. Conversely, if the color of the bright region is a chromatic color, it is judged that an arbitrary color fog has occurred, and the entire image is converted so that the HL color is approximate to an achromatic color.
A problem posed in this case is the relationship between two parameters used in the above two color balance corrections. If a color of a reference white point derived from the estimated light source color temperature is different from the HL color of an image, either of these parameters is likely to be wrong. Alternatively, both parameters may have errors.
For example, in the former color balance correction, the light source estimation is done using gray and skin color pixels of an image. However, since an image does not always include a skin color region, a wrong light source at the time of shooting may be estimated in this case.
In the latter color balance correction, for example, when an image of yellow flowers is shot in a macro mode, the HL color of an image is calculated from a yellow flower region. In this case, although an image originally has a proper color balance, it may be judged that the image has an improper color balance.
When the color balance correction is performed using either one of these parameters, the color balance of an image may be considerably broken. Even in such situations, it is required that a stable color balance correction is performed which suffers less extreme adverse image effects. However, the related arts have not proposed any effective solutions.